﻿@using LunwenYun.Infrastructure.Entities.Entity;
@using LunwenYun.Infrastructure.Entities.Enum;
@using LunwenYun.Tool.Framework;
@{
    Layout = "/Views/Shared/_m_Main.cshtml";
}
<div class="container">
    <div class="row">
        <div class="span3">
            <ul class="nav nav-tabs nav-stacked">
                <li class="active"><a href="/m/authorcenter"><i class="icon-user"></i><strong>个人中心</strong></a></li>
                <li class="active"><a href="/m/authorcenter">我的投稿</a></li>
                <li><a href="/m/myorders">我的约稿 
                @if(ViewBag.OrderCount > 0)
                {
                    <span class="badge badge-warning">@ViewBag.OrderCount</span>
                }</a></li>
                @*<li><a href="/m/profile">个人信息</a></li>*@
                <li><a href="/m/resetpassword">修改密码</a></li>
            </ul>
        </div>
        <div class="span9">
            <blockquote>
                <p>
                    <strong>我的投稿</strong></p>
                <small>您可以在此查看您所有的投稿信息，以及稿件状态。</small>
            </blockquote>
            <table class="table table-hover">
                <tbody>
                    @{
                        ItemListBox<Article> list = ViewBag.Data;
                        if (list != null && list.Data != null && list.Data.Any())
                        {
                            foreach (var item in list.Data)
                            {
                        <tr>
                            <td>
                                <div class="pull-left">
                                    <div class="doc" style="width:80px;height:90px;">
                                        <img alt="doc" src="/content/img/doc.png" /></div>
                                </div>
                                <div class="pull-left">
                                    <h5>
                                        <a target="_blank" href="/j/article/@item.Id">@item.Title</a>
                                        @if(item.MessageBoard != null && item.MessageBoard.Any())
                                        {
                                        <a title="收到约稿信" href="javascript:;"><span class="badge badge-success">@item.MessageBoard.Count</span></a>
                                        }</h5>
                                    <p>
                                        <strong>分类：</strong>@item.IndType.Mapping() -> @item.SubIndType.Mapping()<br />
                                        <strong>方向：</strong>
                                        @if (!String.IsNullOrEmpty(item.Aptitude))
                                        {
                                            string aptString = string.Empty;
                                            List<string> apt = item.Aptitude.Split(';').Where(c => !String.IsNullOrEmpty(c)).ToList();
                                            foreach (var aptitem in apt)
                                            {
                                                try
                                                {
                                                    int iapt = Int32.Parse(aptitem);
                                                    aptString += ((Aptitude)iapt).Mapping() + "、";
                                                }
                                                catch { }
                                            }
                                            aptString = aptString.EndsWith(";") ?
                                                aptString.Remove(aptString.Length) : aptString;
                                            <span>@aptString @item.Language.Mapping()</span>
                                        }
                                        <br />
                                        <strong>预算：</strong>@item.PriceRange</p>
                                        @if(item.MessageBoard!= null && item.MessageBoard.Any())
                                        {
                                        <a href="javascript:;" onclick="togglemessageblock(this)">查看约稿留言>></a>
                                        <div style="display:none;">
                                        <ul style="list-style: none outside none;margin-left:5px;">
                                            @foreach(var m in item.MessageBoard)
                                            {
                                                <li>
                                                    <i class="icon-envelope" style="padding-right:4px;"></i>
                                                    <a target="_blank" href="/j/article/@item.Id">@m.Message.NoHTMLLabel().PieceOfString(0, 23, "...")</a>
                                                </li>
                                            }
                                        </ul>
                                        </div>
                                        }
                                </div>
                            </td>
                            <td style="width: 10%; text-align: right" class="center">
                                @if (item.Status == ArticleStatus.Complete)
                                {
                                    <input type="button" disabled="disabled" class="btn btn-success btn-mini" value="已完成" />
                                }
                                else if (item.ExpireTime < DateTime.Now)
                                {
                                    <input type="button" disabled="disabled" class="btn btn-inverse btn-mini" value="已结束" />
                                }
                                else
                                {
                                    <a target="_blank" href="/j/article/@item.Id" class="btn btn-primary btn-mini">进行中</a>
                                }
                            </td>
                        </tr>
                            }
                        }
                    }
                </tbody>
            </table>
        </div>
        @Html.Raw(list.PageItemSegment)
    </div>
</div>
@section tail
{
    <script type="text/javascript">
        $(function () {
            $('#likcenter').addClass('active');
        });
        function togglemessageblock(sender) {
            $(sender).siblings('div').toggle();
        }
    </script>
}
